package com.doctcloud.hisinfo.histable.domain.outpbill;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.annotation.Excel;
import com.doctcloud.common.core.annotation.NotZero;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

import static com.doctcloud.common.core.utils.StringUtils.trim;

/**
 * @ClassName 门诊开单记录
 * @Author samula
 * @Descripe product by com.doctcloud
 * @Data 2025-09-23 2:43
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode(of={"visitDate","visitNo"})
public class OutpOrderDescDo implements Serializable {
    private static final long serialVersionUID = 1L;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "就诊日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "就诊日期不得为空")
    private Date visitDate;
    @Excel(name="就诊序号")
    @Positive(message="就诊序号不能小于0")
    private Integer visitNo;
    @Excel(name = "患者ID")
    @NotBlank(message = "患者ID不能为空")
    private String patientId;
    @Excel(name = "开单科室代码")
    @NotBlank(message = "开单科室代码不能为空")
    private String orderedByDept;
    @Excel(name = "开单科室医生")
    private String orderedByDoctor;
    @Excel(name = "单据号")
    @NotBlank(message = "单据号不能为空")
    private String rcptNo;
    @Excel(name = "单据类型")
    private Integer prescIndicator;
    @Data
    public static class primaryKey {
        private final Date visitDate;
        private final Integer visitNo;
        public primaryKey(Date visitDate,Integer visitNo) {
            this.visitDate = visitDate;
            this.visitNo = visitNo;
        }
    }
    public void setOrderedByDoctor(String orderedByDoctor) {
        this.orderedByDoctor = orderedByDoctor == null? "[空]":trim(orderedByDoctor);
    }
}
